<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./js/jquery.min.js"></script>
    <script src="./js/jquery.form.js"></script>
</head>
<body>
<form id="mainForm" method="post" action="/dhxy/rest/login">
    name:<input type="text" id="name" name="name">
    password：<input type="text" id="password" name="password">
</form>
<input id="btn_submit" type="button" value="提交">
<script type="text/javascript">
    jQuery(document).ready(function ($) {
        $("#btn_submit").click(function () {
            $('#mainForm').ajaxSubmit({
                type: 'post',
                dataType: 'json',
                success: function (data) {
                    alert(data.message);
                },
                clearForm: false,//禁止清楚表单
                resetForm: false //禁止重置表单
            });

        });
    });

</script>

</body>
</html>